<?php
//@TODO gimana nentuin sebuah model itu algoritmanya apa
//@TODO untuk selain naive bayes. Model untuk kNN gimana?
include_once 'config.php';
$result=array();
if ($_FILES["file"]["size"]>=0 && isset($_POST["model_name"])) {
    if (move_uploaded_file($_FILES["file"]["tmp_name"], "model/".$_POST["model_name"])) {
        $result["status"] = "ok";
        $result["link"] = "http://".$_SERVER["HTTP_HOST"]."/wekaws/data/{$_POST['model_name']}";
        $result["name"] = $_POST['model_name'];
        echo json_encode($result);
    } else {
        $result["status"] = "fail";
        echo json_encode($result);
    }
}
?>
